package org.example.huawei;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Scanner;
import java.util.Set;

/**
 * @author Yyming
 * @version 10.0
 * Created by Yyming on 2021/1/4
 */
public class ttt {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int num = input.nextInt();
        Set<Integer> set = new HashSet<>();
        set.add(2);
        for (int i = 2; i < num; i++) {
            if (cal(i)) {
                set.add(i);
            }
        }
        for (Integer integer : set) {
            int r = num / integer;
            if (set.contains(r) && r * integer == num) {
                if (integer < r) {
                    System.out.println(integer + " " + r);
                } else {
                    System.out.println(r + " " + integer);
                }
                return;
            }
            set.remove(integer);
        }

        System.out.println("-1 -1");

    }

    private static boolean cal(int r) {
        for (int i = 2; i <= Math.sqrt(r); i++) {
            if (r % i == 0) {
                return false;
            }
        }
        return true;
    }
}
